<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/5/5
  Time: 16:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Integer applicationCount = (Integer)application.getAttribute("count");
    Integer sessionCount = (Integer)session.getAttribute("count");
    Integer requestCount = (Integer)request.getAttribute("count");

    if(applicationCount == null){
        application.setAttribute("count",1);
    }else{
        application.setAttribute("count",applicationCount+1);
    }

    if(sessionCount == null){
        session.setAttribute("count",1);
    }else{
        session.setAttribute("count",sessionCount+1);
    }

    if(requestCount == null){
        request.setAttribute("count",1);
    }else{
        request.setAttribute("count",requestCount+1);
    }
%>
<html>
<head>
    <title>JSP作用域展示</title>
</head>
<body>

    <div>
        <label>全局访问次数：</label>
        ${applicationScope.count}
    </div>

    <div>
        <label>会话访问次数：</label>
        ${sessionScope.count}
    </div>

    <div>
        <label>请求访问次数：</label>
        ${requestScope.count}
    </div>

</body>
</html>
